import Web3d from './components/Web3d.vue';
import Renderer from './components/Renderer.vue';
import Person from './components/Person.vue';

import GLTFLoader from "three-gltf-loader";

let components = [
  Web3d,
  Renderer,
  Person
];

const MyWeb3d = {
  install(Vue, options) {
    components.map(component => {
      Vue.component(component.name, component);
    })
  },
  loaders: {
    GLTFLoader(url) {
      return new Promise((resolve, reject) => {
        new GLTFLoader().load(url, gltf => {
          resolve(gltf);
        }, null, err => {
          reject(err);
        })
      })
    }
  }
}

export default MyWeb3d;